package creational.prototype.deepclone1;

import java.util.Hashtable;

/**
 * @Description: 原型缓存
 * @Author: lxt
 * @CreateDate: 2019/11/1
 **/
public class MessageCache {
    private static Hashtable<String, AbstractMessage> cache = new Hashtable<String, AbstractMessage>();

    public static void putMessage(String type, AbstractMessage message) {
        cache.put(type, message);
    }

    public static AbstractMessage getMessage(String messageId) {
        return (AbstractMessage) cache.get(messageId).clone();
    }

}
